package com.cn.wanxi.test;

import java.util.Random;

public class MyMath {
    public static void main(String[] args) {
////        向下取整
//        System.out.println(Math.floor(0.4));
//        System.out.println(Math.floor(0.8));
////        向上取整
//        System.out.println(Math.ceil(0.4));
//        System.out.println(Math.ceil(0.8));
//        四舍五入
//        System.out.println(Math.round(0.4));
//        System.out.println(Math.round(0.8));
//        随机数在0.0和1.0之间[0.0,1.0)
//        double random = Math.random();
//        System.out.println(random);
//        System.out.println(random * 10);
//        System.out.println(Math.floor(random * 10));
//        System.out.println((int) Math.floor(random * 10));

        Random random = new Random();
        for (int i = 0; i < 10; i++) {
            int a = random.nextInt(10);
            System.out.print(a + " ");
        }

    }
}
